package com.d0323;

import java.io.*;

public class Serializable {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        FileOutputStream fos=new FileOutputStream(new File("src/com/d0323/seriData"));
        ObjectOutputStream oos=new ObjectOutputStream(fos);
        Person person=new Person("Jack",22,"Dalian");
        oos.writeObject(person);
        oos.close();
        fos.close();

        FileInputStream fis=new FileInputStream(new File("src/com/d0323/seriData.txt"));
        ObjectInputStream ois=new ObjectInputStream(fis);
        Person person1=(Person) ois.readObject();
        System.out.println(person1.getName()+"/t"+person1.getAge()+"\t"+person1.getAddress());
        ois.close();
        fis.close();
    }
}
